package com.jiang.daily.Q3280;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/01/01 22:11
 */
class Solution {
    private String toBinary(int x) {
        StringBuilder sb = new StringBuilder();
        while(x != 0) {
            sb.append(1 & x);
            x >>= 1;
        }
        return sb.reverse().toString();
    }

    public String convertDateToBinary(String date) {
        int year = Integer.parseInt(date.substring(0, 4));
        int month = Integer.parseInt(date.substring(5, 7));
        int day = Integer.parseInt(date.substring(8, 10));
        return toBinary(year) + "-" + toBinary(month) + "-" + toBinary(day);
    }
}
